import { getInfo, setInfo } from "@/localStorage/user";
export default {
  // 开启命名空间
  namespaced: true,
  state() {
    return {
      // 个人权证相关
      userInfo: getInfo(),
    };
  },
  mutations: {
    get_k_info(state, obj) {
      state.userInfo = obj;
      // 持久化处理
      setInfo(obj);
      console.log(obj, "xxx");
    },
  },
  actions: {
    logout(context) {
      // 个人信息要重置 购物车信息要重置
      context.commit("get_k_info", {});
      context.commit("cart/setShop", [], { root: true });
    },
  },
  getters: {},
};
